home *** CD-ROM | disk | FTP | other *** search
- /************************************ palette_main.c ********/
-
- /* Palettetool.c, a color palette and code generation tool.
- *
- * Copyright (c) 1987, Sun Microsystems, Inc.
- *
- * Note: this code is completely unsupported.
- *
- * Change Notes: (7/1/87, by hsc%vanderbilt@csnet-relay)
- * 1) a colormap stripe is added to reflect the
- * spectrum change while modifying the single
- * entry;
- * 2) colormap file generated is formatted to
- * our local specs.
- *
- */
- #include "p_include.h"
- #include "p_icons.h"
-
- ain(argc, argv)
- nt argc;
- har **argv;
- {
- progname = strsave(*argv);
- palette_init();
-
- base_frame = window_create(NULL, FRAME,
- FRAME_ICON, &palette_icon,
- FRAME_LABEL, "palettetool",
- FRAME_ARGS, argc, argv,
- 0);
-
- control_panel = window_create(base_frame, PANEL,
- WIN_WIDTH, 560,
- 0);
-
- panel_creation();
-
- display_canvas = window_create(base_frame, CANVAS,
- WIN_X, 0,
- WIN_BELOW, control_panel,
- CANVAS_AUTO_SHRINK, FALSE,
- WIN_HEIGHT, 3*MAX_CMAP_LEN-(int)window_get(control_panel, WIN_HEIGHT)-11*(xspace+cwidth)+2*xoff,
- WIN_WIDTH, (int) window_get(control_panel, WIN_WIDTH),
- WIN_VERTICAL_SCROLLBAR, scrollbar_create(0),
- WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0),
- WIN_EVENT_PROC, display_event_proc,
- WIN_CONSUME_PICK_EVENTS, MS_LEFT, MS_MIDDLE, MS_RIGHT, 0,
- 0);
- multiple_canvas = window_create(base_frame, CANVAS,
- WIN_X, 0,
- WIN_BELOW, display_canvas,
- WIN_WIDTH, (int)window_get(control_panel, WIN_WIDTH), /*24*(xspace+cwidth)+2*xoff,*/
- WIN_HEIGHT, 11*(yspace+cheight)+2*yoff,
- CANVAS_AUTO_SHRINK, FALSE,
- WIN_EVENT_PROC, multiple_canvas_event_proc,
- 0);
-
- brush_cursor = cursor_create(CURSOR_IMAGE, &brushpix,
- CURSOR_XHOT, 8, CURSOR_YHOT, 7,
- CURSOR_OP, PIX_SRC|PIX_DST,
- 0);
-
- window_set(multiple_canvas, WIN_CURSOR, brush_cursor, 0);
-
- single_canvas = window_create(base_frame, CANVAS,
- WIN_RIGHT_OF, control_panel,
- WIN_Y, 0,
- WIN_WIDTH, 100,
- WIN_HEIGHT, (int)window_get(display_canvas, WIN_HEIGHT) + (int) window_get(multiple_canvas, WIN_HEIGHT)+(int)window_get(control_panel,WIN_HEIGHT)+10, /*3*MAX_CMAP_LEN,*/
- CANVAS_AUTO_SHRINK, FALSE,
- WIN_EVENT_PROC, single_canvas_event_proc,
- WIN_CONSUME_PICK_EVENTS, MS_LEFT, MS_MIDDLE, MS_RIGHT, 0,
- CANVAS_REPAINT_PROC, paint_single_canvas,
- 0);
-
- put_colors(0, MAX_CMAP_LEN, r, g, b);
- paint_multiple_canvas();
- paint_single_canvas();
-
- panel_set_value(red_slider, r[selected_n]);
- panel_set_value(green_slider, g[selected_n]);
- panel_set_value(blue_slider, b[selected_n]);
-
- window_fit(base_frame);
-
- window_main_loop(base_frame);
-
- }
-